package com.huat.service.Impl;

import com.huat.mapper.UserMapper;
import com.huat.pojo.User;
import com.huat.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Service;


@Component
public class UserServiceImpl implements UserService {
    @Autowired
     UserMapper userMapper;
    @Override
    public boolean login(String email,String password) {
        User user = userMapper.findUser(email);
        if (user!=null){
            if (user.getPassword().equals(password)){
                return true;
            }
        }
        return false;
    }

    @Override
    public boolean register(User user) {
        userMapper.addUser(user);
        return true;
    }

    @Override
    public void logout() {

    }
}

